<?php
namespace Admin\Model;
use Think\Model;
use Think\Model\RelationModel;
class StationModel extends RelationModel{   
    protected $_link = array(
        'staff'=>array(
            'mapping_type'      => self::HAS_MANY,
            'class_name'        => 'staff',
            'foreign_key'   => 'station_id',
            'mapping_fields' =>'name,id,status',
          
        ),
    );

    public function getstation(){
        $station=$this->create();       
            if ($this->add($station)){
                return true;
            }else {
                return false;
            }        
       
    }
    public function getid(){
        $map['station_id']=I('get.station_id');
        return $this->where($map)->find();
    }
    public function delid(){
        $map['station_id']=I('get.station_id');
        return $this->where($map)->delete();
    }
    
    public function updatestation(){
        $stationinfo=$this->create();
        if ($this->save($stationinfo)){
            return true;
        }
        else {
            return false;
        }
    }
    
}